home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cocktail
/
ell.lha
/
ell
/
src
/
ell.ast
< prev
next >
Wrap
Text File
|
1992-08-18
|
2KB
|
104 lines
/*
* ell2 - a redesign of ell
*
* $RCSfile: ell.ast,v $
*
* purpose: abstract syntax tree specification
*
* $Author: grosch $
* $Date: 1992/08/07 15:32:36 $
*/
TREE IMPORT {
FROM Idents IMPORT tIdent;
FROM Sets IMPORT tSet;
FROM StringMem IMPORT tStringRef;
FROM Positions IMPORT tPosition;
FROM SYSTEM IMPORT ADDRESS;
TYPE yyEstra = ADDRESS;
# define yyNodeHead yyEstraInfo: yyEstra;
VAR ScannerName, ParserName: tIdent;
}
GLOBAL {
FROM Idents IMPORT WriteIdent, tIdent, MakeIdent, NoIdent;
FROM Strings IMPORT tString, ArrayToString;
FROM StringMem IMPORT tStringRef;
FROM Positions IMPORT tPosition;
FROM Info IMPORT WriteIdentSet;
FROM IO IMPORT tFile, WriteS, WriteI;
# define writetSet(set) WriteIdentSet (yyf, set);
VAR String : tString;
}
BEGIN {
ScannerName := NoIdent;
ArrayToString ("Parser" , String); ParserName := MakeIdent (String);
}
RULE
Grammar = sections tokens rules .
sections = <
Sections0 = .
Sections = sections REVERSE section .
> .
section = <
Export = codes .
Global = codes .
Local = codes .
Begin = codes .
Close = codes .
> .
codes = <
Codes0 = .
Codes = codes REVERSE code .
> .
Code = [pos: tPosition] [ref: tStringRef] <
code = .
> .
tokens = <
Tokens0 = .
Tokens = tokens REVERSE token .
> .
Token = id number <
token = .
> .
Id = [pos: tPosition] [ident: tIdent] [isstring: BOOLEAN] <
id = .
> .
Number = [pos: tPosition] [value] <
number = .
> .
rules = <
Rules0 = .
Rules = rules REVERSE rule .
> .
Rule = [pos: tPosition] id codes expr -> [iscalling: BOOLEAN] <
rule = .
> .
expr = [pos: tPosition] ->
[first: tSet] [follow: tSet] [fifo: tSet] [recovery: tSet]
[length] [index] [followindex] [recindex] [expindex] <
Option = expr .
Times = expr .
Plus = expr .
List = body: expr sep: expr .
Action = codes .
Leaf = id -> [sure: BOOLEAN] [number] .
alternative = -> [depth] [case: BOOLEAN] <
Alternative0= -> [recover: BOOLEAN] [default: tTree] .
Alternative = alternative REVERSE expr .
> .
sequence = <
Sequence0 = .
Sequence = sequence REVERSE expr .
> .
> .